<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="a b">
    a b
</div>
<div class="a">
    
</div>
<script>
    /*
        1. getElementsByClassName()
     */
    const result = document.getElementsByClassName('a') // [div.a.b,div.a]
    const result1 = document.getElementsByClassName('a b') // [div.a.b]
    console.log(result)
    
    
    /*
        2. classList属性
            - 获取所有的类名
            - 提供了快捷方法
                - add(value)
                - contains(value)
                - remove(value)
                - toggle(value)  已删除则添加,有则删除
                等等方法,可以自己打印看看
     */
    const theNode = document.querySelector('.a')
    console.log(theNode.classList)
    
</script>
</body>
</html>